package io.gitee.tziye.core.kv;

import io.gitee.tziye.RenaiClient;

import java.util.Collection;
import java.util.List;

public abstract class ListOperator extends KvOperator {

    public ListOperator(RenaiClient renaiClient) {
        super(renaiClient);
    }

    public abstract <T> List<T> members(String key, Class<T> clazz);

    public abstract <T> void add(String key, T value);

    public abstract <T> void add(String key, Collection<T> values);

    public abstract <T> void addIfAbsent(String key, T value);

    public abstract <T> void addIfAbsent(String key, Collection<T> values);

    public abstract <T> void insert(String key, int idx, T value);

    public abstract <T> void insert(String key, int idx, Collection<T> values);

    public abstract <T> T get(String key, int idx, Class<T> clazz);

    public abstract <T> List<T> get(String key, int start, int count, Class<T> clazz);

    public abstract <T> T revGet(String key, int idx, Class<T> clazz);

    public abstract <T> List<T> revGet(String key, int start, int count, Class<T> clazz);

    public abstract <T> T pop(String key, int idx, Class<T> clazz);

    public abstract <T> List<T> pop(String key, int idx, int count, Class<T> clazz);

    public abstract <T> T revPop(String key, int idx, Class<T> clazz);

    public abstract <T> List<T> revPop(String key, int idx, int count, Class<T> clazz);

    public abstract int delete(String key, int start, int count);

    public abstract int revDelete(String key, int start, int count);

    public abstract <T> int replace(String key, T oldValue, T newValue);

    public abstract <T> List<Integer> indexOf(String key, T value);

    public abstract <T> Integer firstIndexOf(String key, T value);

    public abstract <T> Integer lastIndexOf(String key, T value);
}
